<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Cloud</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Cloud</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/lib/svengali/plugins/eucalyptus_rb.html">
                lib/svengali/plugins/eucalyptus.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000019">Cloud</a>&nbsp;&nbsp;
      <a href="#M000026">dump_machine_cache_info</a>&nbsp;&nbsp;
      <a href="#M000021">get_a_machine</a>&nbsp;&nbsp;
      <a href="#M000020">get_a_machine_with_imageup</a>&nbsp;&nbsp;
      <a href="#M000023">get_ipaddr_of_instance</a>&nbsp;&nbsp;
      <a href="#M000024">get_ipaddr_of_instance_pre</a>&nbsp;&nbsp;
      <a href="#M000022">is_exist_requested_machine</a>&nbsp;&nbsp;
      <a href="#M000027">load_machine_cache_info</a>&nbsp;&nbsp;
      <a href="#M000025">set_whether_do_cache</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DHCP_LEASE_RANGE</td>
          <td>=</td>
          <td class="context-item-value">&quot;xxx.xxx.xxx.xxx&quot;</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
TODO: enabling lib to find newly booted node without pinging

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">CACHE_FILE_NAME</td>
          <td>=</td>
          <td class="context-item-value">&quot;./machine_cache_hash.yml&quot;</td>
        </tr>
        </table>
      </div>
    </div>



      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000019" class="method-detail">
        <a name="M000019"></a>

        <div class="method-heading">
          <a href="#M000019" class="method-signature">
          <span class="method-name">Cloud</span><span class="method-args">(default_user,default_pass)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000019-source">
<pre>
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 176</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-constant">Cloud</span>(<span class="ruby-identifier">default_user</span>,<span class="ruby-identifier">default_pass</span>)
    <span class="ruby-ivar">@@default_user</span> = <span class="ruby-identifier">default_user</span>
    <span class="ruby-ivar">@@default_pass</span> = <span class="ruby-identifier">default_pass</span>
  <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000026" class="method-detail">
        <a name="M000026"></a>

        <div class="method-heading">
          <a href="#M000026" class="method-signature">
          <span class="method-name">dump_machine_cache_info</span><span class="method-args">(machine_cache_hash)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
machine_cache_hash -&gt; hash : {&quot;xxx.xxx.xxx.xxx&quot; =&gt;
&quot;i-xxxxxxx&quot;, &#8230; }
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000026-source">
<pre>
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 310</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dump_machine_cache_info</span>(<span class="ruby-identifier">machine_cache_hash</span>)
    <span class="ruby-identifier">file</span> = <span class="ruby-identifier">open</span>(<span class="ruby-constant">CACHE_FILE_NAME</span>,<span class="ruby-value str">&quot;w&quot;</span>)
    <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">machine_cache_hash</span>,<span class="ruby-identifier">file</span>)
    <span class="ruby-identifier">file</span>.<span class="ruby-identifier">close</span>()
  <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000021" class="method-detail">
        <a name="M000021"></a>

        <div class="method-heading">
          <a href="#M000021" class="method-signature">
          <span class="method-name">get_a_machine</span><span class="method-args">(params_hash)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
return -&gt; <a href="Machine.html">Machine</a> : <a
href="Machine.html">Machine</a> instance applied network configuration and
establised session
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000021-source">
<pre>
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 196</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_a_machine</span>(<span class="ruby-identifier">params_hash</span>)

    <span class="ruby-comment cmt"># if @@do_cache true, Cloud class tries to reuse guest instance on Eucalyptus</span>
    <span class="ruby-comment cmt"># whether exist appropriate instace is checked in terms of IP address</span>
    <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Cloud</span>.<span class="ruby-identifier">is_exist_requested_machine</span>(<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:ipaddr</span>]) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@@do_cache</span>
      <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;reused a guset instance which has address #{params_hash[:ipaddr]}&quot;</span>
      <span class="ruby-comment cmt"># load instance ID corresponding to requested IP address from cache file</span>
      <span class="ruby-identifier">machine_cache_hash</span> = <span class="ruby-constant">Cloud</span>.<span class="ruby-identifier">load_machine_cache_info</span>()
      <span class="ruby-identifier">instance_id</span> = <span class="ruby-identifier">machine_cache_hash</span>[<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:ipaddr</span>]]
    <span class="ruby-keyword kw">else</span>
      <span class="ruby-comment cmt"># calling of this method isn't needed under normal conditions</span>
      <span class="ruby-identifier">get_ipaddr_of_instance_pre</span>()
      
      <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;executing euca-run-instance....&quot;</span>
      <span class="ruby-comment cmt"># ** Attention ** below is draft code</span>
      <span class="ruby-identifier">instance_id</span> = <span class="ruby-identifier">run_image</span>(<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:imageid</span>])
      <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;euca-run-instance finished.&quot;</span>

      <span class="ruby-comment cmt">#get a CLibIPAddr insance</span>
      <span class="ruby-identifier">ipaddr</span> = <span class="ruby-identifier">get_ipaddr_of_instance</span>(<span class="ruby-identifier">instance_id</span>)
      <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;IP address of the kicked instance: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ipaddr</span>.<span class="ruby-identifier">to_s</span>

      <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;configure network setting to the kicked instance.&quot;</span>
      <span class="ruby-identifier">vanilla_machine</span> = <span class="ruby-constant">Machine</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ipaddr</span>)
      <span class="ruby-identifier">vanilla_machine</span>.<span class="ruby-identifier">set_auth_info</span>(<span class="ruby-constant">DEFAULT_USER</span>,<span class="ruby-constant">DEFAULT_PASS</span>)
      <span class="ruby-identifier">vanilla_machine</span>.<span class="ruby-identifier">establish_session</span>()

      <span class="ruby-identifier">vanilla_machine</span>.<span class="ruby-identifier">config_nw_interface</span>(<span class="ruby-identifier">:ipaddr</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:ipaddr</span>], <span class="ruby-identifier">:interface</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:interface</span>], <span class="ruby-identifier">:netmask</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:netmask</span>], <span class="ruby-identifier">:gateway</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:gateway</span>], <span class="ruby-identifier">:onboot</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;yes&quot;</span>)
      <span class="ruby-identifier">vanilla_machine</span>.<span class="ruby-identifier">set_resolver</span>(<span class="ruby-identifier">:primary_ip</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:dns</span>],<span class="ruby-identifier">:interface</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:interface</span>])

      <span class="ruby-comment cmt">#reloads network configuration</span>
      <span class="ruby-comment cmt">#10 seconds after, this will return with nil value</span>
      <span class="ruby-comment cmt"># TODO: should eliminate assumption for platform</span>
      <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;reload network configuration....&quot;</span>
      <span class="ruby-identifier">puts</span> <span class="ruby-identifier">vanilla_machine</span>.<span class="ruby-identifier">exec!</span>(<span class="ruby-value str">&quot;/sbin/service network restart&quot;</span>, <span class="ruby-value">10</span>)
      <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;reloading of network configuration may have finished.&quot;</span>

      <span class="ruby-comment cmt"># write machine info to cache file</span>
      <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@do_cache</span>
        <span class="ruby-identifier">machine_cache_hash</span> = <span class="ruby-constant">Cloud</span>.<span class="ruby-identifier">load_machine_cache_info</span>()
        <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;----------------loaded_hash------------------&quot;</span>
        <span class="ruby-identifier">debug_p</span> <span class="ruby-identifier">machine_cache_hash</span>.<span class="ruby-identifier">inspect</span>()
        <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;class name of machine_cache_hash is #{machine_cache_hash.class}&quot;</span>
        <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;---------------------------------------------&quot;</span>
        <span class="ruby-identifier">machine_cache_hash</span>[<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:ipaddr</span>]] = <span class="ruby-identifier">instance_id</span>
        <span class="ruby-constant">Cloud</span>.<span class="ruby-identifier">dump_machine_cache_info</span>(<span class="ruby-identifier">machine_cache_hash</span>)
      <span class="ruby-keyword kw">end</span>
      
    <span class="ruby-keyword kw">end</span>
    
    <span class="ruby-identifier">configured_machine</span> = <span class="ruby-constant">Machine</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:ipaddr</span>])
    <span class="ruby-identifier">configured_machine</span>.<span class="ruby-identifier">set_auth_info</span>(<span class="ruby-constant">DEFAULT_USER</span>,<span class="ruby-constant">DEFAULT_PASS</span>)
    <span class="ruby-identifier">configured_machine</span>.<span class="ruby-identifier">establish_session</span>()
    <span class="ruby-identifier">configured_machine</span>.<span class="ruby-identifier">set_instance_info</span>(<span class="ruby-identifier">instance_id</span>)

    <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@do_cache</span>
      <span class="ruby-identifier">configured_machine</span>.<span class="ruby-identifier">set_whether_do_cache</span>(<span class="ruby-keyword kw">true</span>)
    <span class="ruby-keyword kw">end</span>
    
    <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">configured_machine</span>
  <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000020" class="method-detail">
        <a name="M000020"></a>

        <div class="method-heading">
          <a href="#M000020" class="method-signature">
          <span class="method-name">get_a_machine_with_imageup</span><span class="method-args">(params_hash)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
return -&gt; <a href="Machine.html">Machine</a> : <a
href="Machine.html">Machine</a> instance applied network configuration and
establised session
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000020-source">
<pre>
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 182</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_a_machine_with_imageup</span>(<span class="ruby-identifier">params_hash</span>)
    <span class="ruby-identifier">check_has_keys</span>(<span class="ruby-identifier">params_hash</span>,[<span class="ruby-identifier">:imagepath</span>])
    
    <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:imageid</span>] = <span class="ruby-identifier">upload_and_register_image</span>(<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">image_path_str</span>],<span class="ruby-value">120</span>)
      <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;uploading and registration of image failed&quot;</span>
      <span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">&quot;I wll exit&quot;</span>)
    <span class="ruby-keyword kw">end</span>

    <span class="ruby-identifier">not_tested</span>()
    <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_a_machine</span>(<span class="ruby-identifier">params_hash</span>)
  <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <a href="#M000023" class="method-signature">
          <span class="method-name">get_ipaddr_of_instance</span><span class="method-args">(instance_id)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
** Attention ** this is quick-fix implementation
</p>
<pre>
                this method can't work on parallel kicking
</pre>
<p>
return -&gt; <a href="CLibIPAddr.html">CLibIPAddr</a> : xxx
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000023-source">
<pre>
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 268</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_ipaddr_of_instance</span>(<span class="ruby-identifier">instance_id</span>)
    <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@pre_alived_hash</span>
      <span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">&quot;get_ipaddr_of_instance_pre() should be called on the eve of run_image(...)&quot;</span>)
    <span class="ruby-keyword kw">end</span>

    <span class="ruby-identifier">debug_p</span> <span class="ruby-ivar">@@pre_alived_hash</span>.<span class="ruby-identifier">inspect</span>()
    
    <span class="ruby-keyword kw">while</span>(<span class="ruby-keyword kw">true</span>)
      <span class="ruby-identifier">alived_hash</span> = <span class="ruby-identifier">find_machines_on_range_by_ping</span>(<span class="ruby-constant">DHCP_LEASE_RANGE</span>)
      
      <span class="ruby-comment cmt"># find difference</span>
      <span class="ruby-identifier">alived_hash</span>.<span class="ruby-identifier">delete_if</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@@pre_alived_hash</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">key</span>)}

      <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">alived_hash</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
        <span class="ruby-identifier">debug_p</span> <span class="ruby-identifier">alived_hash</span>.<span class="ruby-identifier">inspect</span>()
        <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">alived_hash</span>.<span class="ruby-identifier">shift</span>()[<span class="ruby-value">0</span>]
        <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;found #{ret}&quot;</span>
        <span class="ruby-keyword kw">return</span> <span class="ruby-constant">CLibIPAddr</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ret</span>)
      <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">alived_hash</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
        <span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">&quot;There may be other booting machine!&quot;</span>)
      <span class="ruby-keyword kw">end</span>
      <span class="ruby-identifier">sleep</span> <span class="ruby-value">1</span> <span class="ruby-comment cmt">#leave a space</span>
    <span class="ruby-keyword kw">end</span>

  <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000024" class="method-detail">
        <a name="M000024"></a>

        <div class="method-heading">
          <a href="#M000024" class="method-signature">
          <span class="method-name">get_ipaddr_of_instance_pre</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
call of this method isn&#8216;t needed under normal conditions this method
should be called on the eve of run_image(&#8230;)
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000024-source">
<pre>
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 296</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_ipaddr_of_instance_pre</span>()
    <span class="ruby-ivar">@@pre_alived_hash</span> = <span class="ruby-identifier">find_machines_on_range_by_ping</span>(<span class="ruby-constant">DHCP_LEASE_RANGE</span>)
  <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000022" class="method-detail">
        <a name="M000022"></a>

        <div class="method-heading">
          <a href="#M000022" class="method-signature">
          <span class="method-name">is_exist_requested_machine</span><span class="method-args">(ipaddr)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
ipaddr -&gt; <a href="CLibIPAddr.html">CLibIPAddr</a> whether exist
appropriate instace is checked in terms of IP address
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000022-source">
<pre>
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 260</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_exist_requested_machine</span>(<span class="ruby-identifier">ipaddr</span>)
    <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">is_exist_by_ping</span>(<span class="ruby-identifier">ipaddr</span>)
  <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000027" class="method-detail">
        <a name="M000027"></a>

        <div class="method-heading">
          <a href="#M000027" class="method-signature">
          <span class="method-name">load_machine_cache_info</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
return -&gt; hash: {&quot;xxx.xxx.xxx.xxx&quot; =&gt;
&quot;i-xxxxxxx&quot;, &#8230; } if chache file doesn&#8216;t exist, return
a empty hash
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000027-source">
<pre>
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 318</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">load_machine_cache_info</span>()
    <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">CACHE_FILE_NAME</span>)
      <span class="ruby-identifier">ret_hash</span> = <span class="ruby-keyword kw">nil</span>
      <span class="ruby-identifier">open</span>(<span class="ruby-constant">CACHE_FILE_NAME</span>){ <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">ret_hash</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">file</span>)
      }

      <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ret_hash</span>
    <span class="ruby-keyword kw">else</span>
      <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>()
    <span class="ruby-keyword kw">end</span>
  <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000025" class="method-detail">
        <a name="M000025"></a>

        <div class="method-heading">
          <a href="#M000025" class="method-signature">
          <span class="method-name">set_whether_do_cache</span><span class="method-args">(true_or_false)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
set whether cache and reuse guest instance on Eucalyptus if true value is
set
</p>
<pre>
    - get_a_machine(...) tries to reuse guest instance on Eucalyptus
    - destroy_instance(...) of Machine class doesn't terminate instance
    - write kicked machine info to cache file
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000025-source">
<pre>
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 305</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set_whether_do_cache</span>(<span class="ruby-identifier">true_or_false</span>)
    <span class="ruby-ivar">@@do_cache</span> = <span class="ruby-identifier">true_or_false</span>
  <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>